//
//  OpenFilesArrayController.m
//  Pennyworth Punch Clock
//
//  Created by Chris Karr on 8/6/08.
//  Copyright 2008 Northwestern University. All rights reserved.
//

#import "OpenFilesArrayController.h"
#import "DocumentManager.h"

@implementation OpenFilesArrayController

- (BOOL)tableView:(NSTableView *) tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard
{
	[self setSelectionIndexes:rowIndexes];
	
	NSArray * files = [self selectedObjects];
	
	[pboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:self];
	
	NSMutableArray * paths = [NSMutableArray array];    
	
	for (NSDictionary * file in files)
	{
		NSString * path = [file valueForKey:PATH];
		[paths addObject:path];
	}
	
	[pboard setPropertyList:paths forType:NSFilenamesPboardType];
	
    return YES;
	
}

- (NSDragOperation) tableView:(NSTableView *) tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(int) row
		proposedDropOperation:(NSTableViewDropOperation) op
{
	return NSDragOperationNone;
}

- (BOOL) tableView:(NSTableView *) tableView acceptDrop:(id <NSDraggingInfo>) info row:(int) row 
	 dropOperation:(NSTableViewDropOperation) operation
{
	return NO;
}

@end
